[XEN] [TOOLS] 32on64 compat save/restore: unadjust L3E flags at save time
authorEmmanuel Ackaouy <ack@xensource.com>
Fri, 23 Feb 2007 12:58:20 +0000 (12:58 +0000)
committerEmmanuel Ackaouy <ack@xensource.com>
Fri, 23 Feb 2007 12:58:20 +0000 (12:58 +0000)
Get rid of USER|RW|ACCESSED L3 PTE flags which may be present
in a PAE guest when running on a 64bit hypervisor at save time.
This prevents the restore operation from getting confused by
these flags.
Reset disallowed L3E flags to match PAE case.

Signed-off-by: Emmanuel Ackaouy <ack@xensource.com>
tools/libxc/xc_linux_save.c
xen/include/asm-x86/x86_64/page.h

index 8930b9fc3c8b70caf9be54cd6e31a583787a197c..35a5a5cd55124ca5399d0d8e3aaa9522e5c346a3 100644 (file)
@@ -543,6 +543,18 @@ static int canonicalize_pagetable(unsigned long type, unsigned long pfn,
 
             pte &= ~MADDR_MASK_X86;
             pte |= (uint64_t)pfn << PAGE_SHIFT;
+
+            /*
+             * PAE guest L3Es can contain these flags when running on
+             * a 64bit hypervisor. We zap these here to avoid any
+             * surprise at restore time...
+             */
+            if ( pt_levels == 3 &&
+                 type == XEN_DOMCTL_PFINFO_L3TAB &&
+                 pte & (_PAGE_USER|_PAGE_RW|_PAGE_ACCESSED) )
+            {
+                pte &= ~(_PAGE_USER|_PAGE_RW|_PAGE_ACCESSED);
+            }
         }
 
         if (pt_levels == 2)
index 2cd376a5b33bdc3d1d6482ebf91c3f60219d4ac9..18ec956d146d75413e22709ce258355cfb7bb9d3 100644 (file)
@@ -98,7 +98,7 @@ typedef l4_pgentry_t root_pgentry_t;
 #define L3_DISALLOW_MASK (BASE_DISALLOW_MASK)
 #define L4_DISALLOW_MASK (BASE_DISALLOW_MASK)
 
-#define COMPAT_L3_DISALLOW_MASK L3_DISALLOW_MASK
+#define COMPAT_L3_DISALLOW_MASK 0xFFFFF1E6U
 
 #define PAGE_HYPERVISOR         (__PAGE_HYPERVISOR         | _PAGE_GLOBAL)
 #define PAGE_HYPERVISOR_NOCACHE (__PAGE_HYPERVISOR_NOCACHE | _PAGE_GLOBAL)